var express = require('express');
var router = express.Router();

const { deleteAddressesById, addAddresses,getDresses,updateDresses  } = require("../server/addressesServer.js")

// 删除地址
router.post('/deleteAddressesById', async (req, res) => {
  res.send(await deleteAddressesById(req.body));
});
// 新增
router.post('/addAddresses', async (req, res, next) => {
  const data = await addAddresses(req.body)
  res.send(data)
});
//获取
router.get('/', async (req, res, next) => {
  const data = await getDresses(req.query)
  res.send(data)
});
//更新
router.post('/updateDresses', async (req, res) => {
  res.send(await updateDresses(req.body));
});

module.exports = router;